﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;


using System.Drawing;
using System.Drawing.Design;

using DotSpatial.Controls;

using DotSpatial.Data;
using DotSpatial.Symbology.Forms;
using DotSpatial.Symbology;



namespace HaGisPack
{
    public class PointSymbolEditor : UITypeEditor
    {

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService DialogProvider;
            DialogProvider = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (DialogProvider != null)
            {

                DetailedPointSymbolDialog MyPointSymbolDlg = new DetailedPointSymbolDialog((PointSymbolizer)value);

                //MyPointSymbolDlg.Symbolizer = (DotSpatial.Drawing.IPointSymbolizer)value;

                if (DialogProvider.ShowDialog(MyPointSymbolDlg) == DialogResult.OK)

                    return MyPointSymbolDlg.Symbolizer;
                else
                    return value;
            }
            else
                return value;

        }

        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {

            return UITypeEditorEditStyle.Modal;

            //return base.GetEditStyle(context);
        }

    }


}
